package TOP101;

import java.util.HashMap;

/**
 * @Question BM15
 * @Date 2022/11/6 17:53
 * @Solution
 */
public class BM15 {
    public ListNode deleteDuplicates(ListNode head) {
        // write code here
        if (head == null) {
            return null;
        }
        ListNode slow = head;
        ListNode fast = head;
        while (fast != null) {
            if (slow.val == fast.val) {
                slow.next = fast.next;
                fast = fast.next;
            } else {
                slow = slow.next;
            }
        }
        return head;
    }
}
